﻿using Acme.BookStore.BuyRoomHousprice;
using Acme.BookStore.CustomerTable;
﻿using Acme.BookStore.accommodationS;
using Acme.BookStore.BuyRoomHousprice;
using Acme.BookStore.GoodTable;
using Acme.BookStore.OrderTable;
using Acme.BookStore.RBACTable;
using Acme.BookStore.RoomTable;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;

namespace Acme.BookStore.EntityFrameworkCore;


[ConnectionStringName("Default")]
public class BookStoreDbContext :
    AbpDbContext<BookStoreDbContext>
  
{
    /* Add DbSet properties for your Aggregate Roots / Entities here. */

    #region Entities from the modules

    /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext
     * and replaced them for this DbContext. This allows you to perform JOIN
     * queries for the entities of these modules over the repositories easily. You
     * typically don't need that for other modules. But, if you need, you can
     * implement the DbContext interface of the needed module and use ReplaceDbContext
     * attribute just like IIdentityDbContext and ITenantManagementDbContext.
     *
     * More info: Replacing a DbContext of a module ensures that the related module
     * uses this DbContext on runtime. Otherwise, it will use its own DbContext class.
     */

    //Identity
   

    #endregion

    public BookStoreDbContext(DbContextOptions<BookStoreDbContext> options)
        : base(options)
    {

    }
    public DbSet<UserInfo> userInfos { get; set; }
    public DbSet<Role> roles { get; set; }
    public DbSet<RolePer> RolePers {  get; set; }
    
    public DbSet<UserRole> userRoles { get; set; }
    public DbSet<UserPer> userPers { get; set; }
    public DbSet<Permissions> Permissions { get; set; }
    /// <summary>
    /// 商品表
    /// </summary>
    public DbSet<Goods> Goods { get; set; }
    /// <summary>
    /// 商品订单表
    /// </summary>
    public DbSet<GoodsOrder> GoodsOrders { get; set; }
    /// <summary>
    /// 商品标签表
    /// </summary>
    public DbSet<GoodsTypes> goodsTypes { get; set; }
    /// <summary>
    /// 客户表
    /// </summary>
    public DbSet<Customer> customers { get; set; }
    public DbSet<AppoinTment> AppoinTment { get; set; }
    public DbSet<BuyRoomRecord> buyRoomRecords { get; set; }
    public DbSet<accommodations> Accommodations { get; set; }
    /// <summary>
    /// 房价表
    /// </summary>
    public DbSet<Housprice> housprices { get; set; }
    /// <summary>
    /// 房型表
    /// </summary>
    public DbSet<RoomType> roomTypes { get; set; }
    /// <summary>
    /// 房号表
    /// </summary>
    public DbSet<RoomCodeInfo> roomCodeInfos { get; set; }
    /// <summary>
    /// 订单
    /// </summary>
    public DbSet<Bookroom> bookrooms { get; set; }
    /// <summary>
    /// 房价表
    /// </summary>
    public DbSet<RoomPrices> RoomPrices { get; set; }



    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        /* Include modules to your migration db context */

        builder.ConfigureSettingManagement();
        builder.ConfigureBackgroundJobs();
        builder.ConfigureAuditLogging();
     

        /* Configure your own tables/entities inside here */

        //builder.Entity<YourEntity>(b =>
        //{
        //    b.ToTable(BookStoreConsts.DbTablePrefix + "YourEntities", BookStoreConsts.DbSchema);
        //    b.ConfigureByConvention(); //auto configure for the base class props
        //    //...
        //});
    }
}
